<%@page import="com.jjong.dto.PhotosDto"%>
<%@page import="com.jjong.model.JjongBoardManager"%>
<%@page import="com.jjong.dto.MembersDto"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=EUC-KR"%>
<%
	request.setCharacterEncoding("euc-kr");
%>
<%
	response.setContentType("text/html; charset=euc-kr");
%>
<html>
<head>
<title>photosboard</title>

<script type="text/javascript">
var screenW, screenH;
	screenW = window.screen.width;
	screenH = window.screen.height;
	var count=0;
function fileup(){
	var windowX, windowY;
	
	var url = "./photoup.jsp";
	var props = "dialogWidth=150px; dialogHeight=100px, status=no";
	
	var re = showModalDialog(url,props);
	if(re){
		document.pboard.addr.value = re;	
	}
}

</script>
</head>
<body>



<table style="margin-left: 30" border="0" width="775" height="80"><tr><td><h3><img src="./img/photoboard.jpg"></h3></td></tr>
</table>



<%
	Object obj = request.getAttribute("photolist");
	ArrayList<PhotosDto> plist = null;

	plist = (ArrayList<PhotosDto>) obj;
	if (plist.size() == 0) {
	
%>
<table style="margin-left: 30" border="0" width="775" height="80"><tr><td><h3><img src="./img/nophoto.jpg"></h3></td></tr>
</table>
<%
	} else {
	int total=plist.size();
	int countPerRow=4;
	int t = (int)Math.ceil(total*1.0/countPerRow);
	%>
<form name="msearchform">

	<table border="1" bgcolor="fdf2e6" bordercolor="f3d0a7" style="margin-left: 30 " width="700">
	<% 
	for(int i=0;i<t;i++){
%>

<tr>
				<%
					for (int j = 0; j < countPerRow; j++) {
						%>
						<td width="150" height="150">
				<table>
				<tr>
						<% 
						if(i==t-1 && i*countPerRow+j >total-1){
							%>
							<td>&nbsp;</td>
							<% 
						}else{
							PhotosDto photo = plist.get(i*countPerRow+j);
							String fupload = config.getServletContext().getRealPath("/upload");
							JjongBoardManager fileManager=new JjongBoardManager();
							
							String dirs="./upload/";
							String fdur= config.getServletContext().getRealPath(dirs);
							%>
							<td>
							
							<a href="photocontrol.jsp?command=memimgdetail&imgseq=<%=photo.getImgseq()%>"><img src="<%=dirs%><%=photo.getImage()%>" border="0" width="150" height="150"></a>
							<%=photo.getImgtitle()%><br/>
							<%=photo.getUpdatetime() %>
							</td>
							<% 
						}	
					%>
					</tr>
				   </table>
				</td>
					<%
						
					}
				%>
			
	</tr>
	
	<%
		}
	%>
	</table>
	</form>
	<% 
	
	}//if
	%>
</center>
</body>
</html>